import '../../global/user/logic.dart';
import 'http_man.dart';
import 'result_data.dart';
import 'urlpath.dart';

class Api {
  //登录
  static Future<NetBaseReponse> login(Map<String, dynamic> param) {
    return HttpMan.instance.post(UrlPath.login, args: param);
  }

  //发送验证码
  static Future<NetBaseReponse> sendCode(Map<String, dynamic> param) {
    return HttpMan.instance.post(UrlPath.sendCode, args: param);
  }

  //修改密码
  static Future<NetBaseReponse> updatePassword({
    required String old,
    required String newPwd,
    required String repeatPwd,
  }) {
    return HttpMan.instance.post(UrlPath.updatePwd, args: {
      "oldPwd": old,
      "newPwd": newPwd,
      "repeatPwd": repeatPwd,
      "type": "1",
      "tenantId": UserController.instance.state.user?.tenantId,
    });
  }
}

extension HomeApi on Api {
  static Future<NetBaseReponse> wanjian() {
    return HttpMan.instance.get(UrlPath.wanjian);
  }
}

class MeApi extends Api {
  static Future<NetBaseReponse> versionUpdate() {
    return HttpMan.instance.get(UrlPath.checkUpdate);
  }
}
